#include<iostream>
#include<cmath>
using namespace std;
class Point {
private:
	double x, y;
public:
	Point(double xx, double yy);
	friend double Distance(Point& a, Point& b);
};
Point::Point(double xx, double yy)
{
	this->x = xx;
	this->y = yy;
}
double Distance(Point& a, Point& b) {
	return pow(pow(b.x - a.x, 2) + pow(b.y - a.y, 2), 0.5);

}
int main() {
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		double x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		Point point1(x1, y1);
		Point point2(x2, y2);
		cout << (int)Distance(point1, point2) << endl;
	}
}